//1
Promise.resolve(1)//成功 1
  .then(2)//穿透
  .then(Promise.resolve(3)) //穿透 成功 1
  .then(console.log) //接收成功的值并打印 1


//2
/* Promise.resolve("foo")//成功 foo
  .then(Promise.resolve("hoo"))//穿透
  .then((value) => {
    console.log(value);//foo
  }) */

//3
/* Promise.resolve(1)
  .then(() => {
    return 2
  })//成功 2
  .then(Promise.resolve(3))//穿透
  .then(console.log)//2 */

//4
/* Promise.resolve(1)
  .then(() => {
    return 2
  })//成功 2
  .then(() => {
    return Promise.resolve(3)
  })//成功 3
  .then(console.log)//3 */


//5
/* new Promise((resolve, reject) => {
    reject(1)
  })//失败 1
  .then(value => {
    console.log('成功', value);
  }, reason => {
    console.log('失败', reason); //失败 1
  })
  .then(value => {
    console.log('成功', value); //成功 undefined
  }, reason => {
    console.log('失败', reason);
  })
  .catch(reason => console.log('失败', reason)) *///穿透

//6
/* new Promise((resolve, reject) => {
    reject(1)
  })
  .then(value => {
    console.log('成功', value);
  })//穿透
  .then(value => {
    console.log('成功', value);
  })//穿透
  .catch(reason => console.log('失败', reason))//失败 1 */



//7
/* new Promise((resolve, reject) => {
    reject(1)
  })
  .then(value => {
    console.log('成功', value);
  })//穿透
  .then(value => {
    console.log('成功', value);
  }, reason => {
    console.log('失败hhhhh', reason);//失败hhhh 1
  })
  .catch(reason => console.log('失败', reason)) *///穿透


//8
//1 2 4 3
/* const promise = new Promise((resolve, reject) => {
  console.log(1)
  resolve()
  console.log(2)
})
promise.then(() => {
  console.log(3)
})
console.log(4) */


//9
/* const promise = new Promise((resolve, reject) => {
  resolve('1')
  reject('error')
  resolve('2')
})//成功 1

promise
  .then((data) => {
    console.log(data)//1
  })
  .catch((err) => {
    console.log(err)
  }) */ //穿透


//10
/* Promise.resolve(1)
  .then((data) => {
    console.log(data) //1
    return 2
  })//成功 2
  .catch((err) => {
    return 3
  })//穿透
  .then((data) => {
    console.log(data) //2
  }) */